/**
 * @Description:登录主入口
 * @author 云离
 * @date: 2018/12/28
 */
import React, { Component } from 'react'
import './index.less'
import {Card, Layout} from 'antd'
import LoginForm from './components/LoginForm'
import {injectIntl} from 'react-intl'
import { connect } from 'react-redux'
import {actions} from "../../reducers/system"
import 'particles.js'
import particlesConfig from './particles.config'

const { Header, Content } = Layout

const mapStateToProps = (state, ownProps) => {
    return {
    }
}

const mapDispatchToProps = (dispatch) => {
    return {
        setUser: (user)=> dispatch(actions.setUser(user))
    }
}

class Login extends Component {

    componentDidMount() {
        window.particlesJS('bg-canvas', particlesConfig, function() {
            console.log('callback - particles.js config loaded');
        });
        this.props.setUser(false)
    }

    render() {
        return (
            <div id={'login-bg'}>
                <div className={'bg'}></div>
                <div className={`bg2`}></div>
                <div id='bg-canvas'></div>
                <LoginForm/>
            </div>
        )
    }
}

export default connect(mapStateToProps,mapDispatchToProps)(injectIntl(Login))
